﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Shared/_LayuiList.cshtml";
}

<!--数据表格-->
<table class="layui-hide" id="tableId" lay-filter="tableFilter"></table>

<script>
    layui.use(["table", "form", "exLayer", "exUtils"], function () {
        let table = layui.table;
        let form = layui.form;
        let exLayer = layui.exLayer;
        let exUtils = layui.exUtils;
        let $ = layui.$;

        form.render(); //

        let ThisTable = table.render({
            elem: "#tableId",
            url: "/SysBasic/ViewList/GetList",
            defaultToolbar: [{ title: '显示所有数据', layEvent: 'refresh', icon: 'layui-bg-blue layui-icon-refresh' }, 'exports'],
            toolbar: "#toolbarTpl",
            cols: [[
                { field: "Value", title: "名称", sort: true },
                { field: "Text", title: "创建时间", sort: true }
            ]],
            done: function (res, curr, count) {
                console.log(res, curr, count);
            }
        });

        table.on("toolbar(tableFilter)", function (obj) {
            switch (obj.event) {
                case "refresh":
                    refresh();
                    break;
            }
        });

        table.on("tool(tableFilter)", function (obj) {
            let data = obj.data;
            switch (obj.event) {

            }
        });

        function refresh() {
            ThisTable.reload({
                url: "/SysBasic/ViewList/GetList"
            });
        }
    });
</script>
<script type="text/html" id="toolbarTpl">

</script>